home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.db.net;
-
- import java.io.DataOutputStream;
- import java.io.IOException;
- import symjava.lang.Bignum;
- import symjava.sql.SQLException;
-
- class NetFloat extends NumberField {
- float _fVal;
-
- int getType() {
- return 81;
- }
-
- void readData(ServerObject data) throws SQLException, IOException, ErrorException {
- this._fVal = ((NetData)data).getFloat();
- }
-
- void writeData(DataOutputStream os) throws IOException {
- NetData data = new NetData(this._fVal);
- data.write(os);
- }
-
- public String getString() throws SQLException {
- return ((Field)this).isNull() ? null : String.valueOf(this._fVal);
- }
-
- public boolean getBoolean() throws SQLException {
- if (((Field)this).isNull()) {
- return false;
- } else {
- return this._fVal != 0.0F;
- }
- }
-
- public byte getByte() throws SQLException {
- return ((Field)this).isNull() ? 0 : (byte)((int)this._fVal);
- }
-
- public short getShort() throws SQLException {
- return ((Field)this).isNull() ? 0 : (short)((int)this._fVal);
- }
-
- public int getInt() throws SQLException {
- return ((Field)this).isNull() ? 0 : (int)this._fVal;
- }
-
- public long getLong() throws SQLException {
- return ((Field)this).isNull() ? 0L : (long)this._fVal;
- }
-
- public float getFloat() throws SQLException {
- return ((Field)this).isNull() ? 0.0F : this._fVal;
- }
-
- public double getDouble() throws SQLException {
- return ((Field)this).isNull() ? (double)0.0F : (double)this._fVal;
- }
-
- public Bignum getBignum(int scale) throws SQLException {
- return ((Field)this).isNull() ? null : new Bignum((double)this._fVal, scale);
- }
-
- public void setBoolean(boolean x) throws SQLException {
- if (x) {
- this._fVal = 1.0F;
- } else {
- this._fVal = 0.0F;
- }
-
- super._null = false;
- }
-
- public void setByte(byte x) throws SQLException {
- this._fVal = (float)x;
- super._null = false;
- }
-
- public void setShort(short x) throws SQLException {
- this._fVal = (float)x;
- super._null = false;
- }
-
- public void setInt(int x) throws SQLException {
- this._fVal = (float)x;
- super._null = false;
- }
-
- public void setLong(long x) throws SQLException {
- this._fVal = (float)x;
- super._null = false;
- }
-
- public void setFloat(float x) throws SQLException {
- this._fVal = x;
- super._null = false;
- }
-
- public void setDouble(double x) throws SQLException {
- this._fVal = (float)x;
- super._null = false;
- }
-
- public void setBignum(Bignum x) throws SQLException {
- this._fVal = x.floatValue();
- super._null = false;
- }
-
- public void setString(String x) throws SQLException {
- Float i = new Float(x);
- this._fVal = i;
- super._null = false;
- }
-
- public int getSQLType() {
- return 6;
- }
-
- public Object getObject() throws SQLException {
- return new Double((double)this._fVal);
- }
-
- public void setObject(Object obj) throws SQLException {
- this.setDouble((Double)obj);
- }
- }
-